{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# HTML table to Pandas Data Frame to Portal Item"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "toc": true
   },
   "source": [
    "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
    "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#Read-HTML-table-to-Pandas-Data-Frame\" data-toc-modified-id=\"Read-HTML-table-to-Pandas-Data-Frame-1\">Read HTML table to Pandas Data Frame</a></span></li><li><span><a href=\"#Plot-as-a-map\" data-toc-modified-id=\"Plot-as-a-map-2\">Plot as a map</a></span></li><li><span><a href=\"#Publish-as-Portal-Item\" data-toc-modified-id=\"Publish-as-Portal-Item-3\">Publish as Portal Item</a></span></li></ul></div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Read HTML table to Pandas Data Frame\n",
    "\n",
    "Often we read informative articles that present data in a tabular form. If such data contains location information, it would be much more insightful if presented as a cartographic map. Thus this sample shows how Pandas can be used to extract data from a table within a web page (in this case, a Wikipedia article) and how it can be then brought into the GIS for further analysis and visualization.\n",
    "\n",
    "> **Note**: to run this sample, you need a few extra libraries in your conda environment. If you don't have the libraries, install them by running the following commands from cmd.exe or your shell\n",
    "> ```python\n",
    "> conda install lxml\n",
    "> conda install html5lib\n",
    "> conda install beautifulsoup4\n",
    ">conda install matplotlib\n",
    ">```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "from arcgis.gis import GIS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let us read the Wikipedia article on [Estimated number of guns per capita by country](https://en.wikipedia.org/wiki/Number_of_guns_per_capita_by_country) as a pandas data frame object"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_html(\"https://en.wikipedia.org/wiki/Number_of_guns_per_capita_by_country\")[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(230, 10)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let us process the table by dropping an unnecessary column."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Location</th>\n",
       "      <th>Firearms per 100</th>\n",
       "      <th>Region</th>\n",
       "      <th>Subregion</th>\n",
       "      <th>Population 2017</th>\n",
       "      <th>Civilian firearms</th>\n",
       "      <th>Computation method</th>\n",
       "      <th>Registered firearms</th>\n",
       "      <th>Unregistered firearms</th>\n",
       "      <th>Notes</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>United States</td>\n",
       "      <td>120.5</td>\n",
       "      <td>Americas</td>\n",
       "      <td>North America</td>\n",
       "      <td>326474000</td>\n",
       "      <td>393347000</td>\n",
       "      <td>1</td>\n",
       "      <td>1073743.0</td>\n",
       "      <td>392,273,257 Est.</td>\n",
       "      <td>[note 2]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Falkland Islands</td>\n",
       "      <td>62.1</td>\n",
       "      <td>Americas</td>\n",
       "      <td>South America</td>\n",
       "      <td>3000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2</td>\n",
       "      <td>1705.0</td>\n",
       "      <td>295</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>52.8</td>\n",
       "      <td>Asia</td>\n",
       "      <td>Western Asia</td>\n",
       "      <td>28120000</td>\n",
       "      <td>14859000</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>New Caledonia</td>\n",
       "      <td>42.5</td>\n",
       "      <td>Oceania</td>\n",
       "      <td>Melanesia</td>\n",
       "      <td>270000</td>\n",
       "      <td>115000</td>\n",
       "      <td>2</td>\n",
       "      <td>55000.0</td>\n",
       "      <td>60000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Serbia</td>\n",
       "      <td>39.1</td>\n",
       "      <td>Europe</td>\n",
       "      <td>Southern Europe</td>\n",
       "      <td>6946000</td>\n",
       "      <td>2719000</td>\n",
       "      <td>2</td>\n",
       "      <td>1186086.0</td>\n",
       "      <td>1532914</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Location  Firearms per 100    Region        Subregion  \\\n",
       "0     United States             120.5  Americas    North America   \n",
       "1  Falkland Islands              62.1  Americas    South America   \n",
       "2             Yemen              52.8      Asia     Western Asia   \n",
       "3     New Caledonia              42.5   Oceania        Melanesia   \n",
       "4            Serbia              39.1    Europe  Southern Europe   \n",
       "\n",
       "   Population 2017 Civilian firearms  Computation method  Registered firearms  \\\n",
       "0        326474000         393347000                   1            1073743.0   \n",
       "1             3000              2000                   2               1705.0   \n",
       "2         28120000          14859000                   2                  NaN   \n",
       "3           270000            115000                   2              55000.0   \n",
       "4          6946000           2719000                   2            1186086.0   \n",
       "\n",
       "  Unregistered firearms     Notes  \n",
       "0      392,273,257 Est.  [note 2]  \n",
       "1                   295       NaN  \n",
       "2                   NaN       NaN  \n",
       "3                 60000       NaN  \n",
       "4               1532914       NaN  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "del df['Notes']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Location</th>\n",
       "      <th>Firearms per 100</th>\n",
       "      <th>Region</th>\n",
       "      <th>Subregion</th>\n",
       "      <th>Population 2017</th>\n",
       "      <th>Civilian firearms</th>\n",
       "      <th>Computation method</th>\n",
       "      <th>Registered firearms</th>\n",
       "      <th>Unregistered firearms</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>United States</td>\n",
       "      <td>120.5</td>\n",
       "      <td>Americas</td>\n",
       "      <td>North America</td>\n",
       "      <td>326474000</td>\n",
       "      <td>393347000</td>\n",
       "      <td>1</td>\n",
       "      <td>1073743.0</td>\n",
       "      <td>392,273,257 Est.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Falkland Islands</td>\n",
       "      <td>62.1</td>\n",
       "      <td>Americas</td>\n",
       "      <td>South America</td>\n",
       "      <td>3000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2</td>\n",
       "      <td>1705.0</td>\n",
       "      <td>295</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>52.8</td>\n",
       "      <td>Asia</td>\n",
       "      <td>Western Asia</td>\n",
       "      <td>28120000</td>\n",
       "      <td>14859000</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>New Caledonia</td>\n",
       "      <td>42.5</td>\n",
       "      <td>Oceania</td>\n",
       "      <td>Melanesia</td>\n",
       "      <td>270000</td>\n",
       "      <td>115000</td>\n",
       "      <td>2</td>\n",
       "      <td>55000.0</td>\n",
       "      <td>60000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Serbia</td>\n",
       "      <td>39.1</td>\n",
       "      <td>Europe</td>\n",
       "      <td>Southern Europe</td>\n",
       "      <td>6946000</td>\n",
       "      <td>2719000</td>\n",
       "      <td>2</td>\n",
       "      <td>1186086.0</td>\n",
       "      <td>1532914</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Location  Firearms per 100    Region        Subregion  \\\n",
       "0     United States             120.5  Americas    North America   \n",
       "1  Falkland Islands              62.1  Americas    South America   \n",
       "2             Yemen              52.8      Asia     Western Asia   \n",
       "3     New Caledonia              42.5   Oceania        Melanesia   \n",
       "4            Serbia              39.1    Europe  Southern Europe   \n",
       "\n",
       "   Population 2017 Civilian firearms  Computation method  Registered firearms  \\\n",
       "0        326474000         393347000                   1            1073743.0   \n",
       "1             3000              2000                   2               1705.0   \n",
       "2         28120000          14859000                   2                  NaN   \n",
       "3           270000            115000                   2              55000.0   \n",
       "4          6946000           2719000                   2            1186086.0   \n",
       "\n",
       "  Unregistered firearms  \n",
       "0      392,273,257 Est.  \n",
       "1                   295  \n",
       "2                   NaN  \n",
       "3                 60000  \n",
       "4               1532914  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's process column names so there are no spaces because this can cause inconsistencies with some GIS operations:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.columns = df.columns.str.replace(\" \", \"_\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Location</th>\n",
       "      <th>Firearms_per_100</th>\n",
       "      <th>Region</th>\n",
       "      <th>Subregion</th>\n",
       "      <th>Population_2017</th>\n",
       "      <th>Civilian_firearms</th>\n",
       "      <th>Computation_method</th>\n",
       "      <th>Registered_firearms</th>\n",
       "      <th>Unregistered_firearms</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>United States</td>\n",
       "      <td>120.5</td>\n",
       "      <td>Americas</td>\n",
       "      <td>North America</td>\n",
       "      <td>326474000</td>\n",
       "      <td>393347000</td>\n",
       "      <td>1</td>\n",
       "      <td>1073743.0</td>\n",
       "      <td>392,273,257 Est.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Falkland Islands</td>\n",
       "      <td>62.1</td>\n",
       "      <td>Americas</td>\n",
       "      <td>South America</td>\n",
       "      <td>3000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2</td>\n",
       "      <td>1705.0</td>\n",
       "      <td>295</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>52.8</td>\n",
       "      <td>Asia</td>\n",
       "      <td>Western Asia</td>\n",
       "      <td>28120000</td>\n",
       "      <td>14859000</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>New Caledonia</td>\n",
       "      <td>42.5</td>\n",
       "      <td>Oceania</td>\n",
       "      <td>Melanesia</td>\n",
       "      <td>270000</td>\n",
       "      <td>115000</td>\n",
       "      <td>2</td>\n",
       "      <td>55000.0</td>\n",
       "      <td>60000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Serbia</td>\n",
       "      <td>39.1</td>\n",
       "      <td>Europe</td>\n",
       "      <td>Southern Europe</td>\n",
       "      <td>6946000</td>\n",
       "      <td>2719000</td>\n",
       "      <td>2</td>\n",
       "      <td>1186086.0</td>\n",
       "      <td>1532914</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Location  Firearms_per_100    Region        Subregion  \\\n",
       "0     United States             120.5  Americas    North America   \n",
       "1  Falkland Islands              62.1  Americas    South America   \n",
       "2             Yemen              52.8      Asia     Western Asia   \n",
       "3     New Caledonia              42.5   Oceania        Melanesia   \n",
       "4            Serbia              39.1    Europe  Southern Europe   \n",
       "\n",
       "   Population_2017 Civilian_firearms  Computation_method  Registered_firearms  \\\n",
       "0        326474000         393347000                   1            1073743.0   \n",
       "1             3000              2000                   2               1705.0   \n",
       "2         28120000          14859000                   2                  NaN   \n",
       "3           270000            115000                   2              55000.0   \n",
       "4          6946000           2719000                   2            1186086.0   \n",
       "\n",
       "  Unregistered_firearms  \n",
       "0      392,273,257 Est.  \n",
       "1                   295  \n",
       "2                   NaN  \n",
       "3                 60000  \n",
       "4               1532914  "
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "gis = GIS(profile=\"your_online_admin_profile\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "dpath = r\"/Users/user_name/Job/\"\n",
    "\n",
    "df.to_csv(path_or_buf=dpath + \"worldwide_gun_ownwership_df.csv\", index=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plot as a map\n",
    "Let us connect to our GIS to geocode this data and present it as a map, either by specifying username and password, for example  in `gis = GIS(\"https://www.arcgis.com\", \"your_org_username\", \"your_password\")` or via an existing profile:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "from arcgis.gis import GIS\n",
    "import json\n",
    "\n",
    "#gis = GIS(\"home\")\n",
    "gis = GIS(profile=\"your_online_admin_profile\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The table is using the `Location` column to signify the country name, so we'll create a feature collection by passing the mapping relationship below to the Geocoder through the `import_data()` method:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Location', 'Firearms per 100', 'Region', 'Subregion',\n",
       "       'Population 2017', 'Civilian firearms', 'Computation method',\n",
       "       'Registered firearms', 'Unregistered firearms'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "fc = gis.content.import_data(df, {\"CountryCode\":\"Location\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "gun_fset = fc.query()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "map1 = gis.map(\n",
    "    location = 'Brazil'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<img src=\"\"/>"
      ],
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "map1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "map1.zoom = 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We'll use smart mapping to render the points with varying sizes representing the number of firearms per 100 residents"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "map1.content.add(gun_fset)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "smart_map_mgr = map1.content.renderer(0).smart_mapping()\n",
    "smart_map_mgr.class_breaks_renderer(\n",
    "    break_type=\"size\",\n",
    "    field=\"Firearms_per_100\",\n",
    "    num_classes=4\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "map1.legend.enabled=True"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Publish as Portal Item\n",
    "\n",
    "Let us publish this layer as a **feature collection** item in our GIS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's use the `FolderManager` to get the logged in user's *Root* folder and add the Feature Collection to the folder."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "fmgr = gis.content.folders"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "root = fmgr.get(owner=gis.users.me)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "from arcgis.gis import ItemProperties, ItemTypeEnum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "iprops = ItemProperties(title=\"Worldwide Firearms Ownership Folder stream\",\n",
    "                        item_type=ItemTypeEnum.FEATURE_COLLECTION,\n",
    "                        tags=[\"guns,violence\"],\n",
    "                        snippet = \"GSR Worldwide firearms ownership\",\n",
    "                        description = \"test description\",\n",
    "                        type_keywords = [\"Data\", \"Feature Collection\", \"Singlelayer\"],\n",
    "                        extent = \"-102.5272,-41.7886,172.5967,64.984\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "rf_item = root.add(item_properties=iprops,\n",
    "                   text = json.dumps({\"layers\": [dict(fc.properties)]}))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div class=\"item_container\" style=\"height: auto; overflow: hidden; border: 1px solid #cfcfcf; border-radius: 2px; background: #f6fafa; line-height: 1.21429em; padding: 10px;\">\n",
       "                    <div class=\"item_left\" style=\"width: 210px; float: left;\">\n",
       "                       <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=aa0ee1b071f64423b43911668748a947' target='_blank'>\n",
       "                        <img src='http://static.arcgis.com/images/desktopapp.png' class=\"itemThumbnail\">\n",
       "                       </a>\n",
       "                    </div>\n",
       "\n",
       "                    <div class=\"item_right\"     style=\"float: none; width: auto; overflow: hidden;\">\n",
       "                        <a href='https://geosaurus.maps.arcgis.com/home/item.html?id=aa0ee1b071f64423b43911668748a947' target='_blank'><b>Worldwide Firearms Ownership Folder stream</b>\n",
       "                        </a>\n",
       "                        <br/>GSR Worldwide firearms ownership<br/><img src='https://geosaurus.maps.arcgis.com/home/js/jsapi/esri/css/images/item_type_icons/features16.png' style=\"vertical-align:middle;\" width=16 height=16>Feature Collection by ArcGISPyAPIBot\n",
       "                        <br/>Last Modified: October 11, 2024\n",
       "                        <br/>0 comments, 0 views\n",
       "                    </div>\n",
       "                </div>\n",
       "                "
      ],
      "text/plain": [
       "<Item title:\"Worldwide Firearms Ownership Folder stream\" type:Feature Collection owner:ArcGISPyAPIBot>"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rf_item.result()"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "esriNotebookRuntime": {
   "notebookRuntimeName": "ArcGIS Notebook Python 3 Standard",
   "notebookRuntimeVersion": "9.0"
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": true,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": true,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
